package com.yiren.dbaa.util;

import com.yiren.backstage.currency.bean.GpsInfoBean;

/**
 * @author lwb
 * @date :2022/1/18 8:54
 * @description:  获取距离工具
 */
public class DistanceUtil {
    /**
     * 获取基站距离
     *
     * @param gpsInfo
     * @return
     */
    public static int getBaseDistance(GpsInfoBean gpsInfo) {
        int distance = (int) Math.sqrt(gpsInfo.getDistanceX() * gpsInfo.getDistanceX() + gpsInfo.getDistanceY() * gpsInfo.getDistanceY());
        return distance;
    }

    /**
     * 获取两个Gps之间的距离
     *
     * @param gpsInfo
     * @return
     */
    public static float getBaseDistance(GpsInfoBean gpsInfo, float x2, float y2) {
        float distance = (float) Math.sqrt(Math.pow(x2 - gpsInfo.getDistanceX(), 2) + Math.pow(y2 - gpsInfo.getDistanceY(), 2));
        return distance;
    }



}
